﻿@using Chaine;
@model Chaine.Models.RegisterModel
@{
    ViewBag.Title = "Register";
    Layout = "~/Views/Shared/_NoAuthen.cshtml";
}
@section maincontent{
    <div class="container hero-unit" style="margin-top: 40px;">
        <h1>
            Create a New Account</h1>
        <br />
        <div class="alert alert-info">
            <p>
                Use the form below to create a new account.
            </p>
            <p>
                Passwords are required to be a minimum of @Membership.MinRequiredPasswordLength
                characters in length.
            </p>
        </div>
        <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
        <script type="text/javascript">
            $().ready(function () {
                $("form").submit(function () {
                    if ($(this).valid()) {
                        $(".form-actions input").attr("disabled", "disabled");
                        $(".form-actions input").css("disabled", "disabled");
                        $(".form-actions input").val("Waiting……");
                    }
                });
            });
        </script>
        @using (Html.BeginForm())
        {
            
            @Html.ValidationSummary(true, "Account creation was unsuccessful. Please correct the errors and try again.", new { @class = "alert alert-error" })
            <div class="form-horizontal">
                <fieldset>
                    <legend>Account Information</legend>
                    <div class="control-group @(ViewData.ModelState["UserName"].ErrorClass("error"))">
                        <label class="control-label">
                            UserName</label>
                        <div class="controls">
                            @Html.TextBoxFor(m => m.UserName)
                            @Html.ValidationMessageFor(m => m.UserName, null, new { @class = "help-inline" })
                        </div>
                    </div>
                    <div class="control-group @(ViewData.ModelState["Password"].ErrorClass("error"))">
                        <label class="control-label">
                            Password</label>
                        <div class="controls">
                            @Html.PasswordFor(m => m.Password)
                            @Html.ValidationMessageFor(m => m.Password, null, new { @class = "help-inline" })
                        </div>
                    </div>
                    <div class="control-group @(ViewData.ModelState["ConfirmPassword"].ErrorClass("error"))">
                        <label class="control-label">
                            Confirm Password
                        </label>
                        <div class="controls">
                            @Html.PasswordFor(m => m.ConfirmPassword)
                            @Html.ValidationMessageFor(m => m.ConfirmPassword, null, new { @class = "help-inline" })
                        </div>
                    </div>
                     <div class="control-group  @(ViewData.ModelState["RealName"].ErrorClass("error"))">
                        <label class="control-label">
                            Real Name
                        </label>
                        <div class="controls">
                            @Html.TextBoxFor(m => m.RealName)
                            @Html.ValidationMessageFor(m => m.RealName, null, new { @class = "help-inline" })
                        </div>
                    </div>
                    <div class="control-group  @(ViewData.ModelState["Email"].ErrorClass("error"))">
                        <label class="control-label">
                            Email
                        </label>
                        <div class="controls">
                            @Html.TextBoxFor(m => m.Email)
                            @Html.ValidationMessageFor(m => m.Email, null, new { @class = "help-inline" })
                        </div>
                    </div>
                    <div class="control-group  @(ViewData.ModelState["Mobile"].ErrorClass("error"))">
                        <label class="control-label">
                            Mobile
                        </label>
                        <div class="controls">
                            @Html.EditorFor(m => m.Mobile)
                            @Html.ValidationMessageFor(m => m.Mobile, null, new { @class = "help-inline" })
                        </div>
                    </div>
                    <div class="control-group  @(ViewData.ModelState["Gender"].ErrorClass("error"))">
                        <label class="control-label">
                            Gender
                        </label>
                        <div class="controls">
                            <label class="radio inline">
                                @Html.RadioButtonFor(m => m.Gender, "Male", new { name = "gender" }) Male
                            </label>
                            <label class="radio inline">
                                @Html.RadioButtonFor(m => m.Gender, "Female", new { name = "gender" }) Female
                            </label>
                        </div>
                    </div>
                    <div class="control-group @(ViewData.ModelState["Nationality"].ErrorClass("error"))">
                        <label class="control-label">
                            Nationality
                        </label>
                        <div class="controls">
                            @Html.DropDownListFor(m => m.Nationality, Chaine.Util.CountryList.ToSelectListItem())
                            @Html.ValidationMessageFor(m => m.Nationality, null, new { @class = "help-inline" })
                        </div>
                    </div>
                    <div class="control-group @(ViewData.ModelState["Address"].ErrorClass("error"))">
                        <label class="control-label">
                            Address
                        </label>
                        <div class="controls">
                            @Html.EditorFor(m => m.Address)
                            @Html.ValidationMessageFor(m => m.Address, null, new { @class = "help-inline" })
                        </div>
                    </div>
                    <div class="control-group @(ViewData.ModelState["PostCode"].ErrorClass("error"))">
                        <label class="control-label">
                            Post Code
                        </label>
                        <div class="controls">
                            @Html.EditorFor(m => m.PostCode)
                            @Html.ValidationMessageFor(m => m.PostCode, null, new { @class = "help-inline" })
                        </div>
                    </div>
                    <div class="form-actions">
                        <input type="submit" value="Register" class="btn btn-success btn-large" />
                        @Html.ActionLink("Cancel", "Login", "Account", null, new { @class = "btn btn-large" })
                    </div>
                </fieldset>
            </div>
        }
    </div>
}
